import requests
from concurrent.futures import ThreadPoolExecutor

# 接口 URL 模板
url_template = "http://106.53.146.53:7001/api/ccSmart/syncDimensionByTrackSpanId/invoke?force=true&spanId={}"

# 不同的 spanId 列表
span_ids = [
"xegand6881jb4",
"xevbj4c38ffgg",
"xeb01oplcpmv4",
"xewju42m0zf9c",
"xes39lpkr4rnk",
"xe5cvqh1qkgsg",
"xeedd6kqry800",
"xem1lstmzi41s",
"xerr2pniqjx1c",
"xeux9apeczg1s",
"xe4eop85xt7gg",
"xeeo2jswe3chs",
"xes1s2vr4m4g0",
"xetmvdehskzcw",
"xek7w2nhv320w",
"xege7tkiy7o5c",
"xeoit70xmcl4w",
"xelb5353in6rk",
"xeeba902j36rk",
"xehhgu25s5j40",
"xeegxmzh8yiv4",
"xexcj7t9t2sxs",
"xe3rsfxwumhhc",
"xe3wuf6n6x340",
"xes8wzour7sow",
"xe4v1gff6bbb4",
"xet6im767711c",
"xeurlwq8191c0",
"xe3qopsvzxpts",
"xev2b9yeevu2o",
"xeb76lio7ufb4",
"xekm5w9yyvmyo",
"xeeeupeycdo8w",
"xe47jsemuc64g",
"xe3q3we3owq2o",
"xerun628l3x8g",
"xe59ba2btitq8",
"xevyfdmna6gow",
"xerhuv9o36nls",
"xeglcqe2go3k0",
"xevwxusgh73sw",
"xeox30nouqiv4",
"xegr04d7tfxfk",
"xe3p7qoffuo00",
"xeg3igcssvjeo",
"xeq5zf4ljsxkw",
"xeholqvlh9ji8",
"xereaeutqc4jk",
"xekcy1wcn75s0",
"xe3s0neqbffnk",
"xev5vqcxj63uo",
"xe5asswd7pu68",
"xefwdjjg0n9j4",
"xexcjik9uqxvk",
"xeq2eypqry4u8",
"xerapygnfz20w",
"xel406beivzls",
"xerw4owft2o74",
"xew0ib734vs3k",
"xelpewroksc1s",
"xev0tr48xcjr4",
"xeev7gm82d8u8",
"xexd12vyawdts",
"xexck0tt90pvk",
"xerozs30vfjls",
"xeutouaqsu39c",
"xewes4trnupkw",
"xevragtg1oxds",
"xeghs9za47qww",
"xe53nw2wh4wsg",
"xexciph8igkxs",
"xexci52qht9ts",
"xehvqnpdvcz5s",
"xetqftt913nr4",
"xexckcqzkz11c",
"xercsw0tdkw00",
"xesl3vr1u2sqo",
"xev4e7ixdx05c",
"xexcjcafq8e80",
"xe3vcwcmcozy8",
"xe5nl3p39edc0",
"xe55qtnnue2v4",
"xe5li64l9a77k",
"xevnq0emdsi68",
"xexcgz2w8pi4g",
"xexckmipt9dz4",
"xexckhc14ya68",
"xezipnqwnpc00",
"xexd0fdw4i8lc",
"xezptkg61gpvk",

]

# 请求头
headers = {
    'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
}

# 定义请求函数
def call_api(span_id):
    url = url_template.format(span_id)
    try:
        requests.get(url, headers=headers, timeout=1)  # 设置 timeout 避免阻塞
        print(f"Request sent with spanId={span_id}")
    except Exception as e:
        print(f"Error with spanId={span_id}: {e}")

# 使用线程池异步调用
with ThreadPoolExecutor(max_workers=10) as executor:  # 最多 10 个并发
    executor.map(call_api, span_ids)

print("All requests sent asynchronously!")